package menu;

import me.chanjar.weixin.common.bean.menu.WxMenu;
import me.chanjar.weixin.mp.api.WxMpService;
import com.haois.mp.wechat.config.MenuConfig;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

/**
 * Created by RuiHaoZ on 2017/11/25.
 */
public class LogMenu {

    @Bean
    public MenuConfig menuConfig() {
        return new MenuConfig();
    }
    public static void main(String[] args) {

    }

    @Bean
    public InitializingBean initDefaultMenu() {
        return new InitializingBean() {

            @Autowired
            private WxMpService wxMpService;

            @Override
            public void afterPropertiesSet() throws Exception {
                WxMenu wxMenu = menuConfig().createWxMenu();
//                wxMpService.menuCreate(wxMenu);
            }
        };
    }
}
